<template>
  <a-card :body-style="{padding: '24px 32px'}" :bordered="false">
    <a-form>
      <a-form-item
          label="项目名称"
          :labelCol="{span: 7}"
          :wrapperCol="{span: 10}"
      >
        <a-input v-model="project.project_name"/>
      </a-form-item>
      <a-form-item
          label="申报理由"
          :labelCol="{span: 7}"
          :wrapperCol="{span: 10}"
          :required="false"
      >
        <a-input v-model="project.project_reasion"/>
      </a-form-item>
      <a-form-item
          label="项目简介"
          :labelCol="{span: 7}"
          :wrapperCol="{span: 10}"
      >
        <a-textarea rows="4" v-model="project.project_tip"/>
      </a-form-item>
      <a-form-item
          label="项目详情"
          :labelCol="{span: 7}"
          :wrapperCol="{span: 10}"
      >
        <a-textarea rows="4" v-model="project.project_content"/>
      </a-form-item>
      <a-form-item style="margin-top: 24px" :wrapperCol="{span: 10, offset: 7}">
        <a-button type="primary" @click="updateProject">提交</a-button>
        <a-button style="margin-left: 8px" @click="goBack">返回</a-button>
      </a-form-item>
    </a-form>
  </a-card>
</template>

<script>
import Axios from 'axios'
export default {
  name: 'ModifyProject',
  data () {
    return {
      url: this.$store.state.apiUrl + ':' + this.$store.state.apiPort,
      project: {},
      changeName: '',
    }
  },
  computed: {
    desc() {
      return "你可以在此页面修改申报项目信息，但不可以修改该项目的公司与申报人信息。"
    }
  },
  methods: {
    // 返回上一页
    goBack() {
      window.history.back()
    },
    // 修改项目信息
    updateProject() {
      Axios.put(this.url + '/pxManagerSystem/updateProjectByProjectInfoId', {
        "project_info_id": this.project.project_info_id,
        "project_class_id": this.project.project_class_id,
        "project_name": this.project.project_name,
        "project_tip": this.project.project_tip,
        "project_content": this.project.project_content,
        "company_id": this.project.company_id,
        "company_user_id": this.project.company_user_id,
        "project_reasion": this.project.project_reasion,
        "project_time": this.project.project_time,
        "project_check": this.project.project_check,
        "counts": this.project.counts,
      }).then(res => {
        this.$message.success(res.data.message)
      }).catch(err => {
        console.log(err)
      })
    }
  },
  mounted() {
    this.project = this.$route.params.project
  }
}
</script>

<style scoped>

</style>
